package com.yztc.orangeentertainment.ui.main.subscribefragment.sublablist;

import android.content.Context;

import com.yztc.orangeentertainment.adapter.LabListAdapter;
import com.yztc.orangeentertainment.bean.LabListBean.ListBean;
import com.yztc.orangeentertainment.config.SubscribeUrlConfig;

import java.util.List;
import java.util.Map;

/**
 * Created by My on 2016/10/7.
 */
public class LabListPresenter implements LabListContract.Presenter {
    private LabListContract.View view;
    private LabListModle modle;

    public LabListPresenter(LabListContract.View view) {
        this.view = view;
        modle=new LabListModle();
    }

    @Override
    public void getLabListFromNet(boolean flag,Map<String, String> params, final Context context) {
        if (!flag) {
            modle.getLabListAll(SubscribeUrlConfig.PATH.URL_LABLIST_TYPE, params, new OnLoadLabListListener() {
                @Override
                public void onSuccess(List<ListBean> list) {
                    view.onLoadLabListSuccess(list);
                }

                @Override
                public void onFailure(Exception e) {

                }
            }, context);
        }else {
            modle.getSearchStar(SubscribeUrlConfig.PATH.URL_SEARCH_TYPE, params, context, new OnLoadLabListListener() {
                @Override
                public void onSuccess(List<ListBean> list) {
                    view.onLoadSearchStarSuccess(list);
                }

                @Override
                public void onFailure(Exception e) {

                }
            });
        }
    }

    @Override
    public void getLabListFromDb() {

    }


}
